package com.chen.controller;

import com.chen.utils.JwtUtils;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @GetMapping("/isLike")
    public String isLike(HttpServletRequest request){
        //点赞前必须是登录状态
        //前端必须把请求头带过来
        //校验token
        String token = request.getHeader("token");
        try {
            JwtUtils.validate(token);
            return "点赞成功";
        } catch (Exception e) {
            return e.getMessage();
        }
    }
}
